# Scrapy settings for spider_qunaer project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
#     https://docs.scrapy.org/en/latest/topics/settings.html
#     https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
#     https://docs.scrapy.org/en/latest/topics/spider-middleware.html
import os
import sys
import django
sys.path.append(os.path.dirname(os.path.abspath('.')))
os.environ['DJANGO_SETTINGS_MODULE'] = 'xinan_web.settings'  # 项目名.settings
django.setup()


BOT_NAME = 'spider_qunaer'

SPIDER_MODULES = ['spider_qunaer.spiders']
NEWSPIDER_MODULE = 'spider_qunaer.spiders'


# Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = 'spider_qunaer (+http://www.yourdomain.com)'

# Obey robots.txt rules
ROBOTSTXT_OBEY = False

# Configure maximum concurrent requests performed by Scrapy (default: 16)
#CONCURRENT_REQUESTS = 32

# Configure a delay for requests for the same website (default: 0)
# See https://docs.scrapy.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
DOWNLOAD_DELAY = 3
# The download delay setting will honor only one of:
#CONCURRENT_REQUESTS_PER_DOMAIN = 16
#CONCURRENT_REQUESTS_PER_IP = 16

# Disable cookies (enabled by default)
COOKIES_ENABLED = "lxsdk_cuid=1944a1dbcd6c8-048878bbdef596-26011851-13c680-1944a1dbcd7c8; _lxsdk=1944a1dbcd6c8-048878bbdef596-26011851-13c680-1944a1dbcd7c8; _hc.v=9997661c-3688-c251-2b47-5e00ab77f8e1.1736410251; s_ViewType=10; ctu=8c4cdc8f76a845fe8930ad8648321dc81747f652aabe7afcda27ed9b9417551a; HMACCOUNT=5458F4B01BE153B3; __CACHE@is_login=true; logan_custom_report=; ua=%E6%B2%89%E6%80%9D%E5%BD%95; Hm_lvt_602b80cf8079ae6591966cc70a3940e7=1737455649,1737618632,1738575563; __CACHE@referer=https://www.dianping.com/beijing/ch35/d1; WEBDFPID=9425x59yz5655xyw1076v1v1563x35018055z8v859v9795839uxvuy1-1739810319523-1736410270840KKWWWOGfd79fef3d01d5e9aadc18ccd4d0c95072397; qruuid=3a376384-8af4-4a1b-82e1-643cdc70f83f; dplet=f2534c424f1f0496b422e42ed12227e6; dper=0202e9238ffad58ced67d338398d68a9c43ae0e99ff217216a54a367f24b4f27cfef3cfb2611210cc6082a229501b19c7770cfcaf66746db203700000000e926000010c7d0ded6bf12cbb6db2debc9424613c3f0b5abe2de3373374d11cb8a524d08bab22c63def270a9996cf647ddbb216d; ll=7fd06e815b796be3df069dec7836c3df; logan_session_token=vfzqac3egb7u20hqa1do; fspop=test; cy=9; cye=chongqing; Hm_lpvt_602b80cf8079ae6591966cc70a3940e7=1739724667; _lxsdk_s=1950fa02b41-9e3-991-ae3%7C%7C261"

# Disable Telnet Console (enabled by default)
#TELNETCONSOLE_ENABLED = False

# Override the default request headers:
#DEFAULT_REQUEST_HEADERS = {
#   'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
#   'Accept-Language': 'en',
#}

# Enable or disable spider middlewares
# See https://docs.scrapy.org/en/latest/topics/spider-middleware.html
#SPIDER_MIDDLEWARES = {
#    'spider_qunaer.middlewares.SpiderQunaerSpiderMiddleware': 543,
#}

# Enable or disable downloader middlewares
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
#DOWNLOADER_MIDDLEWARES = {
#    'spider_qunaer.middlewares.SpiderQunaerDownloaderMiddleware': 543,
#}

# Enable or disable extensions
# See https://docs.scrapy.org/en/latest/topics/extensions.html
#EXTENSIONS = {
#    'scrapy.extensions.telnet.TelnetConsole': None,
#}
USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"

# Configure item pipelines
# See https://docs.scrapy.org/en/latest/topics/item-pipeline.html
ITEM_PIPELINES = {
   'spider_qunaer.pipelines.SpiderQunaerPipeline': 300,
}

# Enable and configure the AutoThrottle extension (disabled by default)
# See https://docs.scrapy.org/en/latest/topics/autothrottle.html
#AUTOTHROTTLE_ENABLED = True
# The initial download delay
#AUTOTHROTTLE_START_DELAY = 5
# The maximum download delay to be set in case of high latencies
#AUTOTHROTTLE_MAX_DELAY = 60
# The average number of requests Scrapy should be sending in parallel to
# each remote server
#AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
# Enable showing throttling stats for every response received:
#AUTOTHROTTLE_DEBUG = False

# Enable and configure HTTP caching (disabled by default)
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
#HTTPCACHE_ENABLED = True
#HTTPCACHE_EXPIRATION_SECS = 0
#HTTPCACHE_DIR = 'httpcache'
#HTTPCACHE_IGNORE_HTTP_CODES = []
#HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
